/**
 * 代号:金花 
 * 文件名：AbstractFactoryPatternDemo.java
 * 创建人：jh
 * 日期：2018年8月28日
 * 修改人：
 * 描述：
 */
package cc.pattern.shapeColor;


import cc.pattern.factory.Water;
import cc.pattern.shapeColor.abs.AbstractFactory;
import cc.pattern.shapeColor.factory.Orgin;
import cc.pattern.shapeColor.getFactory.FactoryProducer;
import cc.pattern.shapeColor.impl.Pizza;
import org.junit.Test;

/**
 * 用途：业务模块名称
 */
public class AbstractFactoryPatternDemo {
	@Test
	public void main() {
		AbstractFactory shapeFactory = FactoryProducer.getFactory("Shape");
		Shape shape = shapeFactory.getShape("Circle");
		shape.draw();

		AbstractFactory colorFactory = FactoryProducer.getFactory("Color");
		Color c = colorFactory.getColor("Green");
		c.fill();
		c = colorFactory.getColor("Red");
		c.fill();
		c = colorFactory.getColor("Black");
		c.fill();

		AbstractFactory footFactory = FactoryProducer.getFactory("Foot");
		Foot foot = footFactory.getFoot(Water.class.getSimpleName());
		foot.eat();
		foot = footFactory.getFoot(Pizza.class.getSimpleName());
		foot.eat();
		foot = footFactory.getFoot(Orgin.class.getSimpleName());
		foot.eat();

	}
}
